package com.xizimall.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.xizimall.service.PictureService;
import com.xizimall.common.utils.JsonUtils;

/**
 * 上传图片处理
 * <p>Title: PictureController</p>
 * <p>Description: </p>
 * <p>华南理工大学研究生</p> 
 * @author	李隆熹
 * @date	2018年4月14日下午6:08:43
 * @version 1.0
 */
@Controller
public class PictureController {
   @Autowired
   PictureService pictureService;
   @RequestMapping("/pic/upload")
   @ResponseBody
   public String pictureUpload(MultipartFile uploadFile){
	   Map result=pictureService.uploadPictrue(uploadFile);
	   //为了保证兼容性,需要吧Result转成json格式的字符串
	   String json=JsonUtils.objectToJson(result);
	   return json;
   }
}
